<%@ Page Language="C#" MasterPageFile="~/Employee.master" AutoEventWireup="true" CodeFile="ViewFaultDeliveries.aspx.cs" Inherits="Pages_Employee_ManageFaultDeliveries_ViewFaultDeliveries" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
    <asp:Label ID="Label1" runat="server" Font-Bold="True" Text="View Fault Deliveries" CssClass="header"></asp:Label><br />
    <br />
    <br />
    <table>
        <tr>
            <td>Search Delivery ID:</td>
            <td>
                <asp:TextBox ID="txtSearch" runat="server"></asp:TextBox>
                <asp:Button ID="btnSearch" runat="server" Text="Search" />
                <asp:CustomValidator ID="CustomValidator1" runat="server" ErrorMessage="ID must be a positive integer" ControlToValidate="txtSearch" OnServerValidate="CustomValidator1_ServerValidate"></asp:CustomValidator>
            </td>
        </tr>
    </table>
    <br />
    <asp:Label ID="lblMessage" runat="server"></asp:Label>
    <br />
    <br />
    <asp:GridView ID="gvDeliveries" runat="server" AutoGenerateColumns="False" DataSourceID="faultDeliveriesDataSource" HeaderStyle-CssClass="smallheader" HeaderStyle-BackColor="#a9c0f2" BorderColor="#556CB0" GridLines="Vertical" Width="560px" OnPageIndexChanging="gvDeliveries_PageIndexChanging">
        <Columns>
            <asp:BoundField DataField="DeliverableID" HeaderText="ID" SortExpression="DeliverableID" />
            <asp:BoundField DataField="FaultDate" HeaderText="Fault Date" SortExpression="FaultDate" />
            <asp:BoundField DataField="Reason" HeaderText="Reason" SortExpression="Reason" />
            <asp:BoundField DataField="RefundAmount" HeaderText="Refund" SortExpression="RefundAmount" />
            <asp:CheckBoxField DataField="IsRepaid" HeaderText="Is Repaid" SortExpression="IsRepaid" />
            <asp:HyperLinkField DataNavigateUrlFields="DeliverableID" DataNavigateUrlFormatString="~/Pages_Employee/ManageFaultDeliveries/EditFaultDelivery.aspx?id={0}"
                HeaderText="Edit" Text="Edit" />
            <asp:TemplateField HeaderText="Select">
                <ItemTemplate>
                    <asp:CheckBox ID="cboDelete" runat="server" />
                </ItemTemplate>
            </asp:TemplateField>
        </Columns>
        <HeaderStyle HorizontalAlign="Center" BackColor="#A9C0F2" CssClass="smallheader" />
        <AlternatingRowStyle BackColor="Gainsboro" />
        <RowStyle HorizontalAlign="Center" />
    </asp:GridView>
    <asp:ObjectDataSource ID="faultDeliveriesDataSource" runat="server" OldValuesParameterFormatString="original_{0}"
        SelectMethod="GetFaultDeliveries" TypeName="DALFaultDelivery"></asp:ObjectDataSource>
    <br />
    <asp:Button ID="btnAddFaultDelivery" runat="server" Text="Add new fault delivery" OnClick="btnAddFaultDelivery_Click"/>
    &nbsp;
    <asp:Button ID="btnDeleteFaultDelivery" runat="server" Text="Delete selected items" CausesValidation="false" OnClientClick="return confirm('Are you sure you want to delete selected item(s) ?')" OnClick="btnDeleteFaultDelivery_Click" />
</asp:Content>
